create table companyinfo 
(
recordid int identity (1,1) primary key,
cname nvarchar(200),
cnameByEN nvarchar(100),
telPhone nvarchar(50),
fax nvarchar(50),
address nvarchar(50),
linkman nvarchar(50),
email nvarchar(50),
mobile nvarchar(50),
mark nvarchar(50)
)
go
create table basList
(
recordid int identity(1,1)primary key,
basType nvarchar(200),
basNum nvarchar(100),
basNameI nvarchar(50),
basNameII nvarchar(50),
isSys nvarchar(50),
rmark nvarchar(50),
createDate nvarchar(50),
mark nvarchar(50)
)
go
create table moduleList
(
recordid int identity (1,1) ,
moduleNum nvarchar(50)primary key,
moduleName nvarchar(100),
moduleType nvarchar(50),
createDate nvarchar(50),
mark nvarchar(50),
)
go
create table itemList
(
recordid int identity(1,1),
moduleNum nvarchar(50)constraint fk_moduleNum foreign key references moduleList(moduleNum),
temNum nvarchar(200)primary key,
itemName nvarchar(100),
itemDispC nvarchar(100),
itemDispE nvarchar(100),
itemDispJ nvarchar(100),
itemDispIndex int,
itemWidth int,
itemDispNo bit,
itemDataType nvarchar(100),
createDate datetime,
createUser nvarchar(100),
updateDate datetime,
updateUser nvarchar(100),
mark nvarchar(max)
)
create table accessGroup
(
recordid int identity(1,1),
groupNum nvarchar(50) primary key,
groupName nvarchar(200),
createDate datetime,
createUser nvarchar(100),
updateDate datetime,
updateUser nvarchar(100),
mark nvarchar(max)
)

create table modulAaccess
(
recordid int identity(1,1)primary key,
groupNum nvarchar(50) constraint fk_groupNum1 foreign key references accessGroup(groupNum),
moduleNum nvarchar(50)constraint fk_moduleNum1 foreign key references moduleList(moduleNum),
showAc bit,
addAc bit,
editAc bit,
delAc bit ,
exportAc bit ,
printAc bit ,
importAc bit ,
createDate datetime,
createUser nvarchar(100),
updateDate datetime,
updateUser nvarchar(100),
mark nvarchar(max)
)

create table deptList
(
recordid int identity(1,1),
deptNum nvarchar(50)primary key,
deptName nvarchar(100),
createDate datetime,
createUser nvarchar(100),
updateDate datetime,
updateUser nvarchar(100),
mark nvarchar(max)
)

create table workerList
(
recordid int identity(1,1),
workerNum nvarchar(50)primary key,
name nvarchar(200),
sex nvarchar(50),
cardnum nvarchar(50),
birthday datetime,
title nvarchar(50),
detpNum nvarchar(50)constraint fk_detpNum foreign key references deptList(deptNum),
createDate datetime,
createUser nvarchar(100),
updateDate datetime,
updateUser nvarchar(100),
mark nvarchar(max)
)

create table userList
(
recordid int identity(1,1),
userNum nvarchar(50)primary key,
workerNum nvarchar(50)constraint fk_workerNum foreign key references workerList(workerNum),
groupNum nvarchar(50)constraint fk_groupNum foreign key references accessGroup(groupNum),
pwd nvarchar(100),
createDate datetime,
createUser nvarchar(100),
updateDate datetime,
updateUser nvarchar(100),
mark nvarchar(max)
)

create table productunitrate
(
recordid int identity(1,1)primary key,
unitstart nvarchar(100),
unitbili decimal(8,2),
unitend nvarchar(100),
mark nvarchar(max)
)

create table materialListstockDetail
(
recordid int identity (1,1) ,
matNum nvarchar(100)primary key,
mtype nvarchar(100) constraint fk_mtype1 foreign key references MaterialType(mtype),
matName nvarchar(100),
qtyqc decimal(8,2),
rkqty decimal(8,2),
ckqty decimal(8,2),
tkqty decimal(8,2),
qtyqm decimal(8,2),
matSpec nvarchar(100),
unit nvarchar(100),
Fzunit nvarchar(100),
matLot nvarchar(100),
stockName nvarchar(100)constraint fk_materiastockName1 foreign key references stockList(stockName),
posName nvarchar(100)constraint fk_posName1 foreign key references stockPosition(posName),
mark nvarchar(max)
)
